package com.cn.integration.business.paycenter.controller;

import com.cn.common.model.Result;
import com.cn.integration.business.paycenter.bo.OpenAccountBo;
import com.cn.integration.business.paycenter.bo.PayFeeBo;
import com.cn.integration.business.paycenter.service.AccountService;
import com.cn.integration.business.paycenter.vo.OpenAccountVo;
import com.cn.integration.common.BaseController;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/web/ump/account")
public class PayController extends BaseController {

    @Resource
    private AccountService accountService;

    @GetMapping("/openAccount")
    public Result<OpenAccountVo> openAccount(@Param("payChannelCode") String payChannelCode) {
        OpenAccountBo openAccountBo = new OpenAccountBo();
        openAccountBo.setPayChannelCode(payChannelCode);
        OpenAccountVo openAccountVo = accountService.openAccount(openAccountBo);
        return Result.success(openAccountVo);
    }

    @GetMapping("/payFee")
    public Result<OpenAccountVo> payFee(@Param("payChannelCode") String payChannelCode) {
        PayFeeBo payFeeBo = new PayFeeBo();
        payFeeBo.setPayChannelCode(payChannelCode);
        return Result.success(accountService.payFee(payFeeBo));
    }

}
